package com.bitcola.security.admin.biz;


import cn.hutool.core.util.IdUtil;
import cn.hutool.core.util.StrUtil;
import com.bitcola.security.admin.mapper.ColaCoinSymbolMapper;
import com.bitcola.security.admin.vo.CoinSymbol;
import com.bitcola.security.common.biz.BaseBiz;
import com.bitcola.entity.ColaCoinSymbol;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 交易对
 *
 * @author Mr.AG
 * @email 463540703@qq.com
 * @date 2018-08-01 09:03:17
 */
@Service
public class ColaCoinSymbolBiz extends BaseBiz<ColaCoinSymbolMapper, ColaCoinSymbol> {


    public List<CoinSymbol> pages(){
        return mapper.pages();
    }

    public Boolean modify(ColaCoinSymbol symbol){
        Integer k = 0;
        if(StrUtil.isEmpty( symbol.getId())){
            symbol.setId(IdUtil.fastUUID());
            //新增
            k = mapper.insertSelective( symbol);
        }else{
            //编辑
            k = mapper.updateByPrimaryKeySelective( symbol);
        }
        return  k > 0;
    }

    public CoinSymbol findByCondition(String id){
        return mapper.findByCondition( id);
    }

    public Boolean deleteSymbol(ColaCoinSymbol symbol){
        return mapper.deleteByPrimaryKey(symbol) > 0;
    }
}